
<head>
<link href="../_Resource/line/css.css" rel="stylesheet" media="screen">
</head>
<body>
<div id="main">
<div id="chart_option">
            <div class="menu" id="period">
                <span data-type="shishi" data-interval="1" data-id="001" data-tpid=0 class="">分时</span>
                <span data-type="k" data-interval="1" data-id="001" data-tpid=1 class="cur">1分</span>
                <span data-type="k" data-interval="5" data-id="005" data-tpid=2>5分</span>
                <span data-type="k" data-interval="15" data-id="015" data-tpid=3>15分</span>
                <span data-type="k" data-interval="30" data-id="030" data-tpid=4>30分</span>
                <span data-type="k" data-interval="60" data-id="060" data-tpid=5>60分</span>
                <span data-type="k" data-interval="60" data-id="100" data-tpid=6 class="">日线</span>
                <span data-type="k" data-interval="60" data-id="200" data-tpid=7 class="">周线</span>
                <span data-type="k" data-interval="60" data-id="300" data-tpid=8 class="">月线</span>
            </div>
            <div class="menu" id="indicator" style="position:relative;">
                <dl style="position:absolute;">
                    <dt>指标</dt>
                    <dd id="mi">
                        <div class="label">主图指标</div>
                        <span data-type="changeMI" data-id="MA" class="cur"><i class="icon_check"></i> MA</span>
                        <span data-type="changeMI" data-id="BOLL"><i class="icon_check"></i> BOLL</span>
                    </dd>
                    <dd id="vi">
                        <div class="label">副图指标</div>
                        <span data-type="changeVI" data-id="MACD" class="cur"><i class="icon_check"></i> MACD</span>
                        <span data-type="changeVI" data-id="KDJ"><i class="icon_check"></i> KDJ</span>
                        <span data-type="changeVI" data-id="RSI"><i class="icon_check"></i> RSI</span>
                        <span data-type="changeVI" data-id="PSY"><i class="icon_check"></i> PSY</span>
                    </dd>
                </dl>
            </div>
           
        </div>
<div id="chart" style="" >
  <iframe id="chartID"  SCROLLING="NO" src="./chart.html" style=" border:none;width:100%;height:auto;"></iframe>
</div>
</div>
<script type="text/javascript" src="../_Resource/line/jquery.min.js"></script> 
<script type="text/javascript">
	
	
	//	ChartControl.initUrl = "ajax.php?type=getKchart"; //初始化页面的Base URL 参数不用带
		//ChartControl.realTimeUrl = "ajax.php?type=getNewData"; //实时获取数据的URL
		//ChartControl.init();
		
	</script>

<script type="text/javascript">
  $("iframe").width($(this).width());
  $("iframe").height($(window).height()-35);
        //获取数据              
        //图表下方K线图类型切换事件
		var chartType="k";
		var id='001';
		var tpid=1;
		var interval=1;
		var curId=parent.parent.document.getElementById("curId").value;
		var wsturl=parent.parent.document.getElementById("wsturl").value;;
		var lurl=wsturl+"/index.php?s=/Home/Orders/getOrdersKline/currency/"+curId+"/time/"+id;
		
		//console.log(lurl);
  function initFun()
  {
	changeTypeFun()
  }
  function getCartTar(){
	  var chart=window.frames["chartID"]
	  var chartTar=chart.contentWindow
	   if(chartTar==undefined){
		   chartTar=chart.window
	   }
	   return chartTar
  }
  function changeTypeFun()
  {
	   var chartTar=getCartTar()
	   if(chartTar.loadUrl!=undefined){
		   chartTar.chartType=chartType
		   loadUrl=wsturl+"/index.php?s=/Home/Orders/getOrdersKline/currency/"+curId+"/time/"+id;//"http://api.huobi.com/staticmarket/btc_kline_"+id+"_json.js";
		   //console.log(loadUrl);
		   //获取数据用例-日期时间，开盘价，最高价，最低价，收盘价，成交量 
		chartTar.tpid=tpid
		chartTar.interval=interval*60
		chartTar.loadUrl=loadUrl
		chartTar.initFun()
	   }
  }
  function changeMiFun(idName)
  { 
      var chartTar=getCartTar();
      chartTar.changeMiFun(idName)
   }
   function changeViFun(idName)
  { 
      var chartTar=getCartTar();
      chartTar.changeViFun(idName)
   }
       // $(".ul_four li a").unbind();
	  $("#period span").bind("click",function(){
           chartType = $(this).data("type");
           id = $(this).data("id");
		   tpid=$(this).data("tpid");
           interval = $(this).data("interval");
            $("#period span").removeClass("cur");
            $(this).addClass("cur");
			changeTypeFun()
     
        });
		$("#mi span").bind("click",function(){
           
            $("#mi span").removeClass("cur");
			changeMiFun($(this).data("id"))
            $(this).addClass("cur");
			
     
        })
		$("#vi span").bind("click",function(){
        
            $("#vi span").removeClass("cur");
			changeViFun($(this).data("id"))
            $(this).addClass("cur");
			
     
        })
		
		$(function(){
       
        $(window).resize(function() {
			var chart=window.frames["chartID"]
	   
	   var chartTar=chart.contentWindow
	   if(chartTar==undefined){
		   chartTar=chart.window
	   }
		$("iframe").width($(this).width());
		var hei=$(window).height()-35;
		chartTar.resizeFun(hei);
  $("iframe").height(hei);
});
       })
       
       
    </script>
</body>
